<template>
  <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" :visible.sync="visible" class="cu-dialog cu-dialog_center" lock-scroll width="1000px">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
        <el-col :span="12">
          <el-form-item label="师训类别" prop="typeId">
            <el-select v-model="dataForm.typeId" placeholder="请选择" clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in typeIdOptions" :key="index" :label="item.fullName" :value="item.enCode"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="师训标题" prop="title">
            <el-input v-model="dataForm.title" placeholder="示范：第xx期安亲老师岗位培训（线上/地区）" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="师训期数" prop="nper">
            <el-input-number v-model="dataForm.nper" placeholder="数字文本" required :step="1" controls-position="right" :style="{ width: '100%' }"></el-input-number>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="证书模版" prop="certificateTemplate">
            <el-select v-model="dataForm.certificateTemplate" placeholder="请选择" clearable required :style="{ width: '100%' }" filterable lastLevel>
              <el-option-group v-for="group in certificateTemplateOptions" :key="group.id" :label="group.fullName">
                <el-option v-for="item in group.children" :key="item.id" :label="item.fullName" :value="item.enCode"></el-option>
              </el-option-group>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="校区品牌" prop="brand">
            <el-select v-model="dataForm.brand" placeholder="请选择校区品牌" filterable clearable required :style="{ width: '100%' }" multiple>
              <el-option :key="item.id" :label="item.fullName" :value="item.enCode" v-for="item in brandOptions" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="师训日期" prop="trainDate">
            <el-date-picker v-model="dataForm.trainDate" placeholder="请选择" clearable required :style="{ width: '100%' }" type="daterange" range-separator="至" format="yyyy-MM-dd" value-format="timestamp" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export { default } from './index.js'
</script>
<style scoped>
.el-time-spinner__wrapper {
  width: 100% !important;
}
@import url(index.scss);
</style>
